package my.design.proxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author zp
 * @version 1.0
 * @description: CGLIB动态代理
 * @date 2022/10/17 19:08
 */
public class CglibProxy implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("CGLIB代理执行之前");
        Object object = methodProxy.invokeSuper(o,objects);
        System.out.println("CGLIB代理执行之后");
        return object;
    }
}
